home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / FLTK-1.0.6 / test / browser.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-26  |  2.5 KB  |  101 lines

  1. //
  2. // "$Id: browser.cxx,v 1.5.2.1 1999/04/26 06:45:28 bill Exp $"
  3. //
  4. // Browser test program for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-1999 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems to "fltk-bugs@easysw.com".
  24. //
  25.  
  26. /*
  27. This is a test of how the browser draws lines.
  28. This is a second line.
  29. This is a third.
  30.  
  31. That was a blank line above this.
  32.  
  33. @r@_Right justify
  34. @c@_Center justify
  35. @_Left justify
  36.  
  37. @bBold text
  38. @iItalic text
  39. @b@iBold Italic
  40. @fFixed width
  41. @f@bBold Fixed
  42. @f@iItalic Fixed
  43. @f@i@bBold Italic Fixed
  44. @lLarge
  45. @l@bLarge bold
  46. @sSmall
  47. @s@bSmall bold
  48. @s@iSmall italic
  49. @s@i@bSmall italic bold
  50. @uunderscore
  51. @C1RED
  52. @C2Green
  53. @C4Blue
  54.  
  55.     You should try different browser types:
  56.     Fl_Browser
  57.     Fl_Select_Browser
  58.     Fl_Hold_Browser
  59.     Fl_Multi_Browser
  60. */
  61.  
  62. #include <FL/Fl.H>
  63. #include <FL/Fl_Select_Browser.H>
  64. #include <FL/Fl_Double_Window.H>
  65. #include <stdio.h>
  66. #include <string.h>
  67. #include <errno.h>
  68. #include <stdlib.h>
  69.  
  70. void b_cb(Fl_Widget* o, void*) {
  71.   printf("callback, selection = %d, event_clicks = %d\n",
  72.      ((Fl_Browser*)o)->value(), Fl::event_clicks());
  73. }
  74.  
  75. int main(int argc, char **argv) {
  76.   int i;
  77.   if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help);
  78.   const char* fname = (i < argc) ? argv[i] : "browser.cxx";
  79.   Fl_Window window(400,400,fname);
  80.   window.box(FL_NO_BOX); // because it is filled with browser
  81.   Fl_Select_Browser browser(0,0,400,400,0);
  82.   browser.type(FL_MULTI_BROWSER);
  83.   //browser.color(42);
  84.   browser.callback(b_cb);
  85.   // browser.scrollbar_right();
  86.   //browser.has_scrollbar(Fl_Browser::BOTH_ALWAYS);
  87.   if (!browser.load(fname)) {
  88.     printf("Can't load %s, %s\n", fname, strerror(errno));
  89.     exit(1);
  90.   }
  91.   browser.position(0);
  92.   window.resizable(&browser);
  93.   window.show(argc,argv);
  94.   return Fl::run();
  95. }
  96.  
  97. //
  98. // End of "$Id: browser.cxx,v 1.5.2.1 1999/04/26 06:45:28 bill Exp $".
  99. //
  100.  
  101.